home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / xmasspak / tales / tales.asm < prev    next >
Encoding:
Assembly Source File  |  1996-01-06  |  12.0 KB  |  405 lines

  1. ;===================================================================
  2. ; TALES OF INFINITY - INTRO V1.0
  3. ;                   
  4. ; done 11'95 by Capella/Escape
  5. ;
  6. ; Using EGA-mode 640*350 pixel with 16 colors
  7. ; The logo needs the 1st 3 Bitplanes to get 8 colors [2^3 = 8]
  8. ; The scrolly is running in the 4th bitplane
  9. ;===================================================================
  10.  
  11. ideal
  12. model large
  13. p386n
  14. stack 256
  15.  
  16. assume cs:tales_code
  17.  
  18. textlength      = 480
  19. scrollerypos    = 300*80
  20. sinuspeed       = 4
  21.  
  22. segment tales_code 
  23.  
  24. start:          mov ax,tales_data       ; the data-segment to DS
  25.                 mov ds,ax
  26.                 assume ds:tales_data
  27.  
  28.                 mov ax,0a000h           ; the video-ram to ES
  29.                 mov es,ax
  30.                 assume es:0a000h
  31.  
  32.                 mov ax,tales_text       ; the text-segment to FS                
  33.                 mov fs,ax
  34.                 assume fs:tales_text
  35.  
  36.                 mov ax,1201h      ;disable DAC-setting
  37.                 mov bx,31h
  38.                 int 10h
  39.  
  40.                 mov dx,03dah      ; reset Flip-Flop
  41.                 in al,dx          ; (needed to reset sequence-controller)
  42.  
  43.                 mov cx,17         ; merge DAC with 16mode-colorlines
  44.                 mov dx,03c0h
  45.                 xor al,al
  46. set_p:          out dx,al
  47.                 out dx,al
  48.                 inc al
  49.                 dec cx
  50.                 jnz set_p
  51.  
  52.                 mov dx,03dah      ; reset Flip-Flop
  53.                 in al,dx
  54.  
  55.                 mov dx,03c0h      ; reset sequence-controller
  56.                 mov al,32
  57.                 out dx,al
  58.  
  59.                 mov ax,0010h      ; turn on 640*350 pixelmode with 16 colors
  60.                 int 10h           ; and 2 graphics-pages
  61.               
  62.                 mov si,offset colorpal  ;set colorpal for 16 colors
  63.                 mov dx,03c8h
  64.                 mov cx,16*3
  65.                 xor al,al
  66.                 out dx,al
  67.                 inc dx
  68. col_l:          mov al,[ds:si]
  69.                 out dx,al
  70.                 inc si
  71.                 dec cx
  72.                 jnz col_l
  73.              
  74. warte:          mov ax,0a800h     ; begin of 1st loop
  75.                 mov es,ax         ; page 1 is now on and we're copying the new
  76.                                   ; positions of the logo and the scrolly on
  77.                 call clear_page   ; the 2nd page
  78.                 call print_logo    
  79.                 call do_scrolly
  80.                 
  81.                 mov dx,03d4h      ; switching to 2nd page
  82.                 mov ax,800ch
  83.                 out dx,ax
  84.                 
  85.                 mov dx,03dah      ; waiting for vertical-retrace, after this
  86. wb1:            in al,dx          ; the monitor will show the 2nd page
  87.                 test al,8         ; (used for timing)
  88.                 jne wb1
  89. wb2:            in al,dx
  90.                 test al,8
  91.                 je wb2
  92.                 
  93.                 mov ax,0a000h     ; begin of the 2nd loop
  94.                 mov es,ax         ; page 2 is on now and we're copying the new
  95.                                   ; positions of the logo and the scrolly to
  96.                 call clear_page   ; the 1st page
  97.                 call print_logo
  98.                 call do_scrolly
  99.  
  100.                 mov dx,03d4h      ; switching to the 1st page
  101.                 mov ax,000ch
  102.                 out dx,ax
  103.                 
  104.                 mov dx,03dah      ; again timing with the vertical-retrace to
  105. wb3:            in al,dx          ; make the movement smoooooooth......
  106.                 test al,8
  107.                 jne wb3
  108. wb4:            in al,dx
  109.                 test al,8
  110.                 je wb4
  111.  
  112.                 in al,60h         ; checks for the ESC-key
  113.                 cmp al,01
  114.                 jne warte
  115.                 
  116.                 mov ax,1200h      ; enable DAC-setting
  117.                 mov bx,31h
  118.                 int 10h
  119.  
  120.                 mov ax,0003h      ; activate textmode
  121.                 int 10h
  122.  
  123.                 mov ah,09h             ; shows the end-text on screen
  124.                 mov dx,offset endtext
  125.                 int 21h
  126.                 
  127.                 mov ax,4c00h      ; bye, bye
  128.                 int 21h
  129.  
  130. ;============================================
  131. ; THE ROUTINES
  132. ;============================================
  133.  
  134. include "shift_c.inc"   ; this routine scrolls the scrolly bit by bit
  135. include "get_c.inc"     ; this routine reads 81 chars from text into the buffer
  136. include "print_s.inc"   ; this routine prints 80-chars on the screen
  137.  
  138. ;
  139. ; PRINT_LOGO  = shows the logo at the specified position in DI
  140. ;
  141.  
  142. print_logo:     mov si,[ds:sinuspos]            ; get value from the counter
  143.                 add si,offset sinus_table       ; add begin of table to it
  144.  
  145.                 mov ax,[ds:si]                  ; read ypos for logo
  146.                 cmp ax,0ffffh                   ; compare with end-byte
  147.                 jne pl0                         ; no! then go on
  148.                 xor ax,ax                       ; else reset to begin of table
  149.                 mov [ds:sinuspos],ax
  150.                 jmp pl00
  151.  
  152. pl0:            add [ds:sinuspos],sinuspeed     ; increment sinus-counter
  153. pl00:           mov di,ax                       ; always in 2 steps coz of WORD
  154.                 add di,12                       ; -size of sinus-datas
  155.                 push di
  156.  
  157.                 mov dx,03c4h            ; copy plane 1
  158.                 mov ax,0102h
  159.                 out dx,ax
  160.                 
  161.                 mov cx,70               ; get 70 lines of the logo
  162.                 mov si,offset logo
  163.  
  164. pl2:            push cx
  165.                 push si
  166.                 push di
  167.  
  168.                 mov cx,52/4             ; each line has 440 pixel (55*8)
  169. pl1:            mov eax,[ds:si]
  170.                 mov [es:di],eax
  171.                 add si,4
  172.                 add di,4
  173.                 dec cx
  174.                 jnz pl1
  175.  
  176.                 mov ax,[ds:si]
  177.                 mov [es:di],ax
  178.                 inc si
  179.                 inc di
  180.                 mov al,[ds:si]
  181.                 mov [es:di],al
  182.                 
  183.                 pop di
  184.                 pop si
  185.                 pop cx
  186.  
  187.                 add si,4*55
  188.                 add di,80
  189.                 
  190.                 dec cx
  191.                 jnz pl2
  192.                 
  193.                 pop di
  194.                 push di
  195.                 
  196.                 mov dx,03c4h            ; copy plane 2
  197.                 mov ax,0202h
  198.                 out dx,ax
  199.                 
  200.                 mov cx,70
  201.                 mov si,offset logo
  202.                 add si,1*55
  203.  
  204. pl4:            push cx
  205.                 push si
  206.                 push di
  207.  
  208.                 mov cx,52/4
  209. pl3:            mov eax,[ds:si]
  210.                 mov [es:di],eax
  211.                 add si,4
  212.                 add di,4
  213.                 dec cx
  214.                 jnz pl3
  215.  
  216.                 mov ax,[ds:si]
  217.                 mov [es:di],ax
  218.                 inc si
  219.                 inc di
  220.                 mov al,[ds:si]
  221.                 mov [es:di],al
  222.                 
  223.                 pop di
  224.                 pop si
  225.                 pop cx
  226.  
  227.                 add si,4*55
  228.                 add di,80
  229.                 dec cx
  230.                 jnz pl4
  231.                 
  232.                 pop di
  233.  
  234.                 mov dx,03c4h            ; copy plane 3
  235.                 mov ax,0402h
  236.                 out dx,ax
  237.  
  238.                 mov cx,70
  239.                 mov si,offset logo
  240.                 add si,2*55
  241.  
  242. pl6:            push cx
  243.                 push si
  244.                 push di
  245.  
  246.                 mov cx,52/4
  247. pl5:            mov eax,[ds:si]
  248.                 mov [es:di],eax
  249.                 add si,4
  250.                 add di,4
  251.                 dec cx
  252.                 jnz pl5
  253.  
  254.                 mov ax,[ds:si]
  255.                 mov [es:di],ax
  256.                 inc si
  257.                 inc di
  258.                 mov al,[ds:si]
  259.                 mov [es:di],al
  260.                 
  261.                 pop di
  262.                 pop si
  263.                 pop cx
  264.  
  265.                 add si,4*55
  266.                 add di,80
  267.                 dec cx
  268.                 jnz pl6
  269.  
  270.                 ret
  271.  
  272. ;
  273. ; CLEAR_PAGE = clears the page before putting the logo on the next position
  274. ;
  275.  
  276. clear_page:     mov dx,03c4h
  277.                 mov ax,0702h
  278.                 out dx,ax
  279.  
  280.                 mov cx,350*80/4
  281.                 xor di,di
  282.                 xor eax,eax
  283. cp1:            mov [es:di],eax
  284.                 add di,4
  285.                 dec cx
  286.                 jnz cp1
  287.  
  288.                 ret
  289.  
  290. ;
  291. ; DO_SCROLLY = puts the scrolly on the screen at the actual page
  292. ;
  293.  
  294. do_scrolly:     mov dx,03c4h            ; turn on all 3 bitmaps used by the
  295.                 mov ax,0802h            ; logo
  296.                 out dx,ax
  297.  
  298.                 mov si,offset scroll_buffer  ; scroll the scrolly-chars
  299.                 call shift_chars
  300.                 mov si,offset scroll_buffer
  301.                 call shift_chars
  302.  
  303.                 mov ax,[ds:scroll_count]     ; check if we scrolled 8 pixel
  304.                 add ax,2                     ; if yes we've to increment the
  305.                 cmp ax,8                     ; text-counter by 1 (8pixel)   
  306.                 jb ds1
  307.                 
  308.                 mov si,[ds:textpos]
  309.                 inc si
  310.                 cmp si,textlength
  311.                 jb ds2
  312.                 xor si,si
  313. ds2:            mov [ds:textpos],si
  314.  
  315.                 mov di,offset scroll_buffer  ; read 81 chars into buffer
  316.                 mov cx,81                    ; for pixel-scrolling   
  317.                 call get_chars
  318.                 
  319.                 xor ax,ax
  320. ds1:            mov [ds:scroll_count],ax
  321.  
  322.                 mov si,offset scroll_buffer  ; put them on the screen
  323.                 mov di,scrollerypos
  324.                 call print_scroll
  325.  
  326.                 ret
  327.  
  328. ends  tales_code
  329.  
  330. segment  tales_data  
  331.  
  332. endtext         db "TALES OF INFINITY - Groningen's No.1 Board........",13,10
  333.                 db "Call at: +31-(0)50-5734105  ; 288oo bps /24h online /running PCBoard",13,10,10
  334.                 db "Code&GFX by Capella/Escape",13,10
  335.                 db "Text by your SysoGOD Lord Beavis/Escape",13,10,10,"$"
  336.  
  337.  
  338.  
  339.  
  340. cflag           db 0    ; needed for the bitscrolling of the chars
  341.  
  342. textpos         dw 0    ; shows the actual position of the scrolly
  343. scroll_count    dw 0    ; counts the bit-movements
  344. sinuspos        dw 0    ; shows the actual position of the sinus_table
  345.  
  346. scroll_buffer   db 81*16 dup (0)        ; buffer to store 81 chars from the
  347.                                         ; scrolltext to show them on the
  348.                                         ; screen....
  349.  
  350. include "colorpal.db"   ; the table with 16 colors for the Logo and Scrolly
  351. include "bold.db"       ; the charset
  352. include "tales1.db"     ; the logo
  353.  
  354. Label sinus_table WORD  ; the sinustable
  355.  
  356.                 dw 000,000,000 
  357.                 dw 080,080
  358.                 dw 160
  359.                 dw 240
  360.                 dw 320
  361.                 dw 400
  362.                 
  363.                 ypos = 480
  364.                 rept 111
  365.                 dw ypos
  366.                 ypos = ypos +160
  367.                 endm
  368.  
  369.                 ypos = 111*160+480
  370.                 rept 111
  371.                 dw ypos
  372.                 ypos = ypos -160
  373.                 endm
  374.  
  375.                 dw 400    
  376.                 dw 320,320     
  377.                 dw 240,240,240
  378.                 dw 160,160,160   
  379.                 dw 080,080,080 
  380.                    
  381.  
  382.                 dw 0ffffh,0ffffh,0ffffh,0ffffh,0ffffh,0ffffh    ; eof-bytes
  383.  
  384. ends  tales_data
  385.  
  386. segment  tales_text  
  387.  
  388. itext           db 160 dup (32)
  389.                 db " Test-Scrolly, Test-Scrolly, hye man, this is a Test-Scrolly, can you be"   
  390.                 db "live it ???????      Yes, it's a Test-Scrolly !!!!!! Simple but who care"
  391.                 db "s ?!?!?!?!     call also our other boards listed up in the Escape.NFO-fi"
  392.                 db "le !       anything else ???? no!, well let's wrap this shit .......    "
  393.                 db 80 dup (32)
  394.                 db 80 dup (32)
  395.                 
  396. ends  tales_text
  397.  
  398. end start
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.